﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using Beauty.Module.Pos;
namespace Beauty
{ 
		public class Iv_productCollectionSource: UICollectionViewSource
		{

			List<productItem> listCellProducts;

			int typeCell= 0 ;
			public Iv_productCollectionSource (List<productItem> temp, int type)
			{
				listCellProducts = temp;
				typeCell = type;
			}


			public override int NumberOfSections (UICollectionView collectionView)
			{
				return 1;
			}
			public override int GetItemsCount (UICollectionView collectionView, int section)
			{
				return listCellProducts.Count;
			}
			public override void ItemHighlighted (UICollectionView collectionView, NSIndexPath indexPath)
			{
 			}
			public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
			{

				switch (typeCell) {
			case 0:

				var CellGrid = (productCell)collectionView.DequeueReusableCell (new NSString ("gridCell"), indexPath);
				var	CellGridItem = listCellProducts [indexPath.Row];
				if (indexPath.Row == 0) {
					CellGrid.Image = PosUtility.ImageFromInventory ("add-button");
				} else {
					CellGrid.Image = CellGridItem.ProductImage;
				}
					return CellGrid;

				case 1:
					var cellTable = (productCellList)collectionView.DequeueReusableCell (new NSString ("tableCell"), indexPath);
					var CellTableItem = listCellProducts [indexPath.Row];
					cellTable.Image = CellTableItem.ProductImage;
					return cellTable;

				default:
					break;
				}

				return null;

			}
//			public override UICollectionReusableView GetViewForSupplementaryElement (UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
//			{
//				if (elementKind == "UICollectionElementKindSectionHeader") {
//					var headerView = (Header1)collectionView.DequeueReusableSupplementaryView (elementKind, new NSString ("Header"), indexPath);
//					return headerView;
//				}
//
//				if (elementKind == "UICollectionElementKindSectionFooter") {
//					var footerView = (Footer1)collectionView.DequeueReusableSupplementaryView (elementKind, new NSString ("Footer"), indexPath);
//					return footerView;
//				}
//
//				return new UICollectionReusableView (); 
//			} 

		}

		public class Iv_serviecsCollectionSource: UICollectionViewSource
		{

			List<ServiceItem> listCellServices;

			static int typeCell = 0;
			public Iv_serviecsCollectionSource (List<ServiceItem> temp,int type)
			{
				listCellServices = temp;
				typeCell = type;
			}
			public override int NumberOfSections (UICollectionView collectionView)
			{

				return 1;
			}
			public override int GetItemsCount (UICollectionView collectionView, int section)
			{
				return listCellServices.Count;
			}
			public override void ItemHighlighted (UICollectionView collectionView, NSIndexPath indexPath)
			{
				 

			}
			public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
			{	

				switch (typeCell) {
				case 0:
					var CellGrid = (serviceCell)collectionView.DequeueReusableCell (new NSString ("gridCell"), indexPath);
					var	CellGridItem = listCellServices [indexPath.Row];
					CellGrid.Image = CellGridItem.ServiceImage;
					return CellGrid;
				case 1:
					var cellTable = (servicesCellList)collectionView.DequeueReusableCell (new NSString ("tableCell"), indexPath);
					var CellTableItem = listCellServices [indexPath.Row];
					cellTable.Image = CellTableItem.ServiceImage;
					return cellTable;

				default:
					break;
				}
				return null;

			}
			 

		}

		public class Iv_packagesCollectionSource: UICollectionViewSource
		{

			List<packageItem> listCellPackages;

			static int typeCell = 0;
			public Iv_packagesCollectionSource (List<packageItem> temp, int type )
			{
				listCellPackages = temp;
				typeCell = type;
			}
			public override int NumberOfSections (UICollectionView collectionView)
			{  

				return 1;
			}
			public override int GetItemsCount (UICollectionView collectionView, int section)
			{
				return listCellPackages.Count;
			}
			public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
			{	

				switch (typeCell) {
				case 0:
					var CellGrid = (packageCell)collectionView.DequeueReusableCell (new NSString ("gridCell"), indexPath);
					var	CellGridItem = listCellPackages [indexPath.Row];
					CellGrid.Image = CellGridItem.PackageImage;
					return CellGrid;
				case 1:
					var cellTable = (packageCellList)collectionView.DequeueReusableCell (new NSString ("tableCell"), indexPath);
					var CellTableItem = listCellPackages [indexPath.Row];
					cellTable.Image = CellTableItem.PackageImage;
					return cellTable;

				default:
					break;
				}
				return null;

			}
			 
		}

		public class Iv_giftCollectionSource: UICollectionViewSource
		{

			List<giftItem> listCellGift;

			static int typeCell = 0;
			public Iv_giftCollectionSource (List<giftItem> temp, int type )
			{
				listCellGift = temp;
				typeCell = type;
			}
			public override int NumberOfSections (UICollectionView collectionView)
			{  

				return 1;
			}
			public override int GetItemsCount (UICollectionView collectionView, int section)
			{
				return listCellGift.Count;
			}
			public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
			{	

				switch (typeCell) {
				case 0:
					var CellGrid = (giftCell)collectionView.DequeueReusableCell (new NSString ("gridCell"), indexPath);
					var	CellGridItem = listCellGift [indexPath.Row];
					CellGrid.Image = CellGridItem.giftImage;
					return CellGrid;
				case 1:
					var cellTable = (giftCellList)collectionView.DequeueReusableCell (new NSString ("tableCell"), indexPath);
					var CellTableItem = listCellGift [indexPath.Row];
					cellTable.Image = CellTableItem.giftImage;
					return cellTable;

				default:
					break;
				}
				return null;

			}
			 
		}
		public class Iv_discountCollectionSource: UICollectionViewSource
		{

			List<discountItem> listCellDiscount;

			static int typeCell = 0;
			public Iv_discountCollectionSource (List<discountItem> temp, int type )
			{
				listCellDiscount = temp;
				typeCell = type;
			}
			public override int NumberOfSections (UICollectionView collectionView)
			{  

				return 1;
			}
			public override int GetItemsCount (UICollectionView collectionView, int section)
			{
				return listCellDiscount.Count;
			}
			public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
			{	

				switch (typeCell) {
				case 0:
					var CellGrid = (discountCell)collectionView.DequeueReusableCell (new NSString ("gridCell"), indexPath);
					var	CellGridItem = listCellDiscount [indexPath.Row];
					CellGrid.Image = CellGridItem.discountImage;
					return CellGrid;
				case 1:
					var cellTable = (discountCellList)collectionView.DequeueReusableCell (new NSString ("tableCell"), indexPath);
					var CellTableItem = listCellDiscount [indexPath.Row];
					cellTable.Image = CellTableItem.discountImage;
					return cellTable;

				default:
					break;
				}
				return null;

			}
			 
		}

	 
	 
}

